package de.hs.rm;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class BHModeActivity extends Activity {
	
	private BHMainApplication mainApp= null;
		
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        prepareImages();
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.mode);
        
        mainApp = (BHMainApplication)this.getApplicationContext();
                
        ImageView ivModeMouse = (ImageView) findViewById(R.id.modeMouseImage);
        ImageView ivModeGamepad = (ImageView) findViewById(R.id.modeGamepadImage);
        ImageView ivModeKeyboard = (ImageView) findViewById(R.id.modeKeyboardImage);
        ImageView ivModeRemote = (ImageView) findViewById(R.id.modeRemoteImage);   
        
        ivModeMouse.setOnClickListener(
	    	new OnClickListener() {
	    		@Override
	    		public void onClick(View v) {
	    			mainApp.sendBTMessage("Start Mouse mode");
	    			Intent intent = new Intent(BHModeActivity.this, BHModeMouseActivity.class);   
	    			startActivity(intent); 			
	    		}
	    	}
        );
        
        ivModeGamepad.setOnClickListener(
	    	new OnClickListener() {
	    		@Override
	    		public void onClick(View v) {
	    			mainApp.sendBTMessage("Start GamePad mode");
	    			Intent intent = new Intent(BHModeActivity.this, BHModeGamepadActivity.class);   
	    			startActivity(intent); 			
	    		}
	    	}
        );
        
        ivModeRemote.setOnClickListener(
	    	new OnClickListener() {
	    		@Override
	    		public void onClick(View v) {
	    			mainApp.sendBTMessage("Start Remote mode");
	    			Intent intent = new Intent(BHModeActivity.this, BHModeRemoteActivity.class);   
	    			startActivity(intent); 			
	    		}
	    	}
        );
        
        ivModeKeyboard.setOnClickListener(
	    	new OnClickListener() {
	    		@Override
	    		public void onClick(View v) {
	    			mainApp.sendBTMessage("Start Keyboard mode");
	    			Intent intent = new Intent(BHModeActivity.this, BHModeKeyboardActivity.class);   
	    			startActivity(intent); 			
	    		}
	    	}
        );
    }
    
    private void prepareImages()
    {
    	ImageConverter.decodeSampledBitmapFromResource(getResources(), R.drawable.keyboardgreen, 200, 200);
    	ImageConverter.decodeSampledBitmapFromResource(getResources(), R.drawable.mousegreen, 200, 200);
    	ImageConverter.decodeSampledBitmapFromResource(getResources(), R.drawable.gamepadgreen, 200, 200);
    	ImageConverter.decodeSampledBitmapFromResource(getResources(), R.drawable.remotegreen, 200, 200);
    }
    
    
    
    
}
